package com.thermofisher.dsc.amanda.model.constant;

import com.thermofisher.dsc.amanda.model.dto.tracking.TrackingDto;

/**
 * @author wenjie.yang on 3/29/2019.
 */
public enum ActionEnum {

  CLICK_LOGIN(1,"登录页面-登录","button","进行登录","Click"),
  CLICK_CUSTOMER_MSG(2,"首页-客户信息","button","点击客户信息","Click"),
  CLICK_PRODUCT_MSG(3,"首页-产品信息","button","点击产品信息","Click"),
  SEARCH_CUSTOMER(4,"选择客户-搜索","search box","搜索客户","Search key words"),
  SELECTED_CUSTOMER(5,"选择客户-选中的客户","button","选中客户","Selected customer ST"),
  CLICK_SUPER_PAYMENT_DAYS(6,"客户信息-超账期","button","进入账期详情","Click"),

  SEARCH_AN_NAME_CUSTOMER(7,"客户信息-选择产品-搜索货号/品名(包含数量)","search box","搜索货号/品名","Search key words"),
  SELECTED_PRODUCT_CUSTOMER(8,"客户信息-选择产品-选中的产品","button","选中货号","selected SKU"),
  CLICK_INVENTORY_CUSTOMER(9,"客户信息-选择产品-库存详情","button","查看库存","Click"),
  CLICK_PRICE_CUSTOMER(10,"客户信息-选择产品-价格详情","button","查看专属价格","Click"),

  SEARCH_AN_NAME_PRODUCT(11,"产品信息-选择产品-货号/品名(包含数量)","search box","搜索货号/品名","Search key words"),
  SELECTED_PRODUCT_PRODUCT(12,"产品信息-选择产品- 选中的产品","search box","选中货号","Selected SKU"),
  CLICK_INVENTORY_PRODUCT(13,"产品信息-选择产品-库存详情","button","查看库存","Click"),
  CLICK_PRICE_PRODUCT(14,"产品信息-选择产品-价格详情","button","查看价格","Click"),

  FORGET_PASSWORD(15,"登录页面-忘记密码","button","找回密码","Click"),
  GET_EXCLUSIVE_PRICE(16,"点击获取客户专属价","button","点击获取客户专属价","Click"),
  RETURN_EXCLUSIVE_PRICE(17,"成功返回获取客户专属价","button","成功返回获取客户专属价","Click"),
  ;
  private Integer action;
  private String button;
  private String eventCategory;
  private String eventAction;
  private String infoCollection;

  ActionEnum(Integer action, String button, String eventCategory, String eventAction,String infoCollection) {
    this.action = action;
    this.button = button;
    this.eventCategory = eventCategory;
    this.eventAction = eventAction;
    this.infoCollection = infoCollection;
  }

  public static ActionEnum getByAction(Integer action){
    for (ActionEnum actionEnum:ActionEnum.values()){
      if (actionEnum.getAction().equals(action)){
        return actionEnum;
      }
    }
    return  null;
  }

  public Integer getAction() {
    return action;
  }


  public String getButton() {
    return button;
  }

  public String getEventCategory() {
    return eventCategory;
  }

  public String getEventAction() {
    return eventAction;
  }

  public String getInfoCollection() {
    return infoCollection;
  }


  public TrackingDto getTracking(){
    TrackingDto trackingDto = new TrackingDto();
    trackingDto.setAction(getAction());
    trackingDto.setButton(getButton());
    trackingDto.setEventAction(getEventAction());
    trackingDto.setEventCategory(getEventCategory());
    trackingDto.setInfoCollection(getInfoCollection());
    return trackingDto;
  }


  /**
   * 获取 从客户-产品  行为信息的 对应
   * @return
   */
  public ActionEnum getDifference(){
    switch (this){
      case SEARCH_AN_NAME_CUSTOMER:
       return SEARCH_AN_NAME_PRODUCT;
      case SELECTED_PRODUCT_CUSTOMER:
        return SELECTED_PRODUCT_PRODUCT;
      case CLICK_INVENTORY_CUSTOMER:
        return CLICK_INVENTORY_PRODUCT;
      case CLICK_PRICE_CUSTOMER:
        return CLICK_PRICE_PRODUCT;
      default:
        return null;
    }
  }

}
